home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / misc / xref_v1.1.lha / XRef / ARexx / xrefaguide.ged < prev   
Encoding:
Text File  |  1994-09-13  |  4.6 KB  |  152 lines

  1. /* ARexx Interface for GoldEd to get help with xref.library and AmigaGuide
  2. **
  3. ** $VER: xrefaguide.ged 1.6 (13.09.94) 
  4. **
  5. ** NAME
  6. **     xrefaguide.ged
  7. **
  8. ** TEMPLATE
  9. **     EDIT/A,ADDPATTERN/A,CATEGORY,NOPATTERN/S,NOCASE/S
  10. **
  11. ** FUNCTION
  12. **     Gets the actual word from GoldEd and passes this to the aguidexref
  13. **     command to open help for this word. You can use patterns for the word.
  14. **
  15. ** INPUTS
  16. **     EDIT      - set to WORD, if a requester should be opened, in which you
  17. **                 can edit the word
  18. **                 set to ARGS, if a requester should be opened, in which you
  19. **                 can edit the argument line for AGuideXRef command
  20. **     ADDPATTERN- set to TRUE, if you want to add the '#?' string at the end
  21. **                 of the given word.
  22. **     CATEGORY  - category to search in
  23. **     NOPATTERN - set , if you don't want pattern in the word
  24. **     NOCASE    - set , if you want case-insensetive word comparision
  25. **
  26. ** EXAMPLE
  27. **     The following command opens first a requester, in which you can edit the
  28. **     word and then searches in the AutoDoc category with case-insensetive
  29. **     comparision for the given word/pattern :
  30. **
  31. **     rx xrefaguide.ged 'WORD TRUE AutoDoc NOCASE'
  32. **
  33. ** SEE ALSO
  34. **     aguidexref,xref.library/ParseXRef(),dos.library/ParsePattern()
  35. **
  36. ** COPYRIGHT
  37. **     Stefan Ruppert , Windthorststraße 5 , 65439 Flörsheim , GERMANY
  38. **
  39. **     (C) Copyright 1994
  40. **     All Rights Reserved !
  41. **
  42. ** $HISTORY:
  43. **
  44. ** 13.09.94 : 001.006 : changed the ADDPATTERN pattern, because makexref
  45. **                      recognizes now the varargs stubs, WORD Request title shows
  46. **                      now AGuideXRef
  47. ** 02.09.94 : 001.005 : removed the GetEnv function and uses now this function from
  48. **                      Rexx:GetEnv file !
  49. ** 10.08.94 : 001.004 : added lastword support,if a empty string is given
  50. ** 10.06.94 : 001.003 : changed ADDPATTERN '#?' TO '%|()'
  51. ** 22.05.94 : 001.002 : ADDPATTERN added and ESCCHARS removed
  52. ** 20.05.94 : 001.001 : ESCCHARS added
  53. ** 17.05.94 : 001.000 : bumped to version 1
  54. ** 17.05.94 : 000.001 : initial
  55. **
  56. */
  57.  
  58. OPTIONS RESULTS                             /* enable return codes     */
  59.  
  60. if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
  61.     address 'GOLDED.1'
  62.  
  63. 'LOCK CURRENT'                              /* lock GUI, gain access   */
  64. OPTIONS FAILAT 6                            /* ignore warnings         */
  65. SIGNAL ON SYNTAX                            /* ensure clean exit       */
  66.  
  67.  
  68. /* ------------------------ INSERT YOUR CODE HERE: ------------------- */
  69.  
  70. PARSE ARG EDIT ADDPATTERN ARGS
  71.  
  72. linelength  = 80                           /* set linelength           */
  73. columns     = 3                            /* set number of columns    */
  74.  
  75. 'QUERY CAT'
  76.  
  77. if (result = "deutsch") then do
  78.    wordtitle = 'Bearbeiten des Wortes für AGuideXRef :'
  79.    argstitle = 'Bearbeiten der Argumente für AGuideXRef :'
  80. end
  81. else do
  82.    wordtitle = 'Edit the word for AGuideXRef :'
  83.    argstitle = 'Edit the Arguments for AGuideXRef :'
  84. end
  85.  
  86. args = args || ' LINELENGTH ' || linelength || ' COLUMNS ' || columns
  87.  
  88. ok = 0
  89.  
  90. 'QUERY CURRENT VAR LINEPTR'
  91. 'QUERY LEN VAR LEN'
  92. 'QUERY SCREEN VAR SCREEN'
  93.  
  94. line = Import(x2c(d2x(lineptr,8)),len)
  95. line = Translate(line, "                             ", "><~!""§$%&/()=|''\*+^;,:.-{}[]")
  96.  
  97. 'QUERY COLUMN VAR POS'
  98.  
  99. pos = Lastpos(" ", line, pos)+1
  100. line = Substr(line, pos)
  101.  
  102. if (left(line,1) ~= ' ') then HWORD = word(line, 1)
  103.                          else HWORD = ''
  104.  
  105. if (HWORD = '') then
  106.    HWORD = GetEnv('AGuideXRef/LastWord')
  107.  
  108. PATTERN = ''
  109. /* add : "(%|'('))" pattern */
  110. if (ADDPATTERN = 'TRUE') then
  111.       PATTERN = '(%|''(''))'
  112.  
  113. if (EDIT = "WORD") then do               /* edit the word              */
  114.    'REQUEST STRING TITLE="' || wordtitle || '" OLD="' || HWORD || '" VAR HWORD'
  115.    ok = RC
  116. end
  117.  
  118. args = HWORD || PATTERN || ' ' || args              /* build the args line        */
  119.  
  120. if (EDIT = "ARGS") then do               /* edit the argument line     */
  121.    'REQUEST STRING TITLE="' || argstitle || '" OLD="' || ARGS || '" VAR ARGS'
  122.    ok = RC
  123. end
  124.  
  125. if (ok = 0) then                         /* run AGuideXRefV39          */
  126. do
  127.    ADDRESS COMMAND 'RUN >NIL: <NIL: AGuideXRefV39 PUBSCREEN ' || screen || ' ' || args
  128.    ADDRESS COMMAND 'SetEnv AGuideXRef/LastWord ' || HWORD
  129. end
  130. /* Examples :
  131. **
  132. ** show all xref-entries with Window inside :
  133. **
  134. ** #?Window#?
  135. **
  136. ** show the doc for ParsePattern
  137. **
  138. ** if(ParsePattern(mytest))
  139. */
  140.  
  141. /* ---------------------------- END OF YOUR CODE --------------------- */
  142.  
  143. 'UNLOCK' /* VERY important: unlock GUI */
  144. EXIT
  145.  
  146. SYNTAX:
  147.  
  148. SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
  149. 'UNLOCK'
  150. EXIT
  151.  
  152.